app.controller('sys_regionViewController', ['$scope', 'httpWrapService', 'dialogs', '$state', '$stateParams',
                        '$location', '$anchorScroll',
            function ($scope, httpWrapService, dialogs, $state, $stateParams, $location, $anchorScroll) {
    $scope.entity = {};
    $scope.id = $stateParams.id;

    if($scope.id) {
    	httpWrapService.post('system/region/view/' + $scope.id + '.do').then(function (res) {
    		$scope.entity = res.data.entity;
    		$scope.type = 'update';
    		if($scope.entity && $scope.entity.parentId){
    			for(var index in data) {
    				var row = data[index];
    				if($scope.entity.parentId == row.id) {
    					$scope.tree.obj = row;
    					break;
    				}
    			}
    		}
    	});
    }


    $scope.canle = function () {
        // 后退到列表页面
        $state.go('app.system.region.list');
    }
    

}]);